package com.greateamd.timetableasy.client.widgets.planning;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Widget;
import com.greateamd.timetableasy.client.domain.EventModality;
import com.greateamd.timetableasy.client.domain.EventType;
import com.greateamd.timetableasy.client.widgets.ClassicLabel;

public class PlanningColorSamples extends Composite {
	
	@UiTemplate("PlanningColorSamples.ui.xml")
	interface PlanningColorSamplesUIBinder extends UiBinder<Widget, PlanningColorSamples> {}
	private static PlanningColorSamplesUIBinder uiBinder = GWT.create(PlanningColorSamplesUIBinder.class);

	@UiField FlexTable grid;
	
	public PlanningColorSamples() {
		initWidget(uiBinder.createAndBindUi(this));
		int i = 0;
		for(EventType type : EventType.values()){
			grid.setWidget(0,i,new ClassicLabel(type.getText()));
			grid.getCellFormatter().setStyleName(0,i++, type.getColorStyle(null));
		}
		i = 0;
		for(EventModality modality : EventModality.values()){
			grid.setWidget(1,i,new ClassicLabel(EventType.COURSE.getText() +"-"+modality.getText()));
			grid.getCellFormatter().setStyleName(1,i++, EventType.COURSE.getColorStyle(modality));
		}
	}
}

